scrolledwindow: Fix calls to gdk_window_move_resize()
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>
Fri, 10 Jun 2016 12:16:53 +0000 (21:16 +0900)
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>
Fri, 10 Jun 2016 12:16:53 +0000 (21:16 +0900)
This is a bit of fallout from 34feba1, now that we resolve
the has_indicators value earlier than realize, it becomes
possible to call gdk_window_move_resize() before realization.

Just added the appropriate checks.

gtk/gtkscrolledwindow.c

index 7d149aee36cc1d3d52fca6bf8a3757261f36ee33..df7302c8f8c9e7fca41b04faf4a49815786a555d 100644 (file)
@@ -1710,11 +1710,12 @@ gtk_scrolled_window_allocate (GtkCssGadget        *gadget,
                                               &child_allocation);
       if (priv->use_indicators)
         {
-          gdk_window_move_resize (priv->hindicator.window,
-                                  child_allocation.x,
-                                  child_allocation.y,
-                                  child_allocation.width,
-                                  child_allocation.height);
+         if (gtk_widget_get_realized (widget))
+           gdk_window_move_resize (priv->hindicator.window,
+                                   child_allocation.x,
+                                   child_allocation.y,
+                                   child_allocation.width,
+                                   child_allocation.height);
           child_allocation.x = 0;
           child_allocation.y = 0;
         }
@@ -1729,11 +1730,12 @@ gtk_scrolled_window_allocate (GtkCssGadget        *gadget,
                                               &child_allocation);
       if (priv->use_indicators)
         {
-          gdk_window_move_resize (priv->vindicator.window,
-                                  child_allocation.x,
-                                  child_allocation.y,
-                                  child_allocation.width,
-                                  child_allocation.height);
+         if (gtk_widget_get_realized (widget))
+           gdk_window_move_resize (priv->vindicator.window,
+                                   child_allocation.x,
+                                   child_allocation.y,
+                                   child_allocation.width,
+                                   child_allocation.height);
           child_allocation.x = 0;
           child_allocation.y = 0;
         }